package controller;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.LinkedList;

import db.DBStatistics;
import db.IFStatistics;
import model.Country;
import model.Customer;
import model.Outsider;
import model.Project;
import model.Statistics;

public class StatisticsController
{
	private static StatisticsController instance = null;

	public static StatisticsController getInstance()
	{
		if(instance == null)
			instance = new StatisticsController();

		return instance;
	}

	public LinkedList<Statistics<Outsider>> getSupplierDeliveryStats(String locationCountry, String locationCity) throws SQLException
	{
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getSupplierDeliveryStats(locationCountry, locationCity);
	}

	public LinkedList<Statistics<Country>> getCountrySupplierStats() throws SQLException
	{
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getCountrySupplierStats();
	}

	public LinkedList<Statistics<Customer>> getCustomerProjectStatsYear(boolean searchDate, String dateYear, String dateMonth, String locationCountry, String locationCity) throws SQLException
	{
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getCustomerProjectStatsYear(searchDate, dateYear, dateMonth, locationCountry, locationCity);
	}

	public LinkedList<Statistics<Customer>> getCustomerProjectStatsPeriod(boolean searchDate, String dateStart, String dateEnd, String locationCountry, String locationCity) throws SQLException
	{
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getCustomerProjectStatsPeriod(searchDate, dateStart, dateEnd, locationCountry, locationCity);
	}

	public ArrayList<String> getProjectAllYears() throws SQLException
	{
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getProjectAllYears();
	}

	public ArrayList<String> getProjectAllMonths(String year) throws SQLException
	{
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getProjectAllMonths(year);
	}

	public ArrayList<String> getProjectCountries() throws SQLException
	{
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getProjectCountries();
	}

	public ArrayList<String> getProjectCities(String country) throws SQLException
	{
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getProjectCities(country);
	}

	public LinkedList<Statistics<Project>> getProjectRevenueStatsYear(boolean searchDate, String dateStart, String dateEnd, String locationCountry, String locationCity) throws SQLException
	{
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getProjectRevenueStatsYear(searchDate, dateStart, dateEnd, locationCountry, locationCity);
	}

	public LinkedList<Statistics<Project>> getProjectRevenueStatsPeriod(boolean searchDate, String dateStart, String dateEnd, String locationCountry, String locationCity) throws SQLException
	{	
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getProjectRevenueStatsPeriod(searchDate, dateStart, dateEnd, locationCountry, locationCity);
	}

	public ArrayList<String> getSupplierDeliveryCountries() throws SQLException
	{
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getSupplierDeliveryCountries();
	}

	public ArrayList<String> getSupplierDeliveryCities(String country) throws SQLException
	{
		IFStatistics dbStatistics = new DBStatistics();

		return dbStatistics.getSupplierDeliveryCities(country);
	}
}